<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
    const ajaxPromise=(param)=>{
        return new Promise((resolve,reject)=>{
            $.ajax({
                type: "get",
                url: param.url,
                dataType: "json",
                success: function (data) {
                    resolve(data)
                },
                error(error){
                    reject(error)
                }
            });
        })
    }
    ajaxPromise({
        url:'./data.json'
    }).then(data=>{
        console.log(data)
    }).catch(error=>{
        console.log(data)
    })
    
</script>
</html>